﻿using System;
using System.Collections.Generic;
using HAVNet.Core.String;
using HAVNet.Core;


namespace HAVNet.Intros.AST
{
    public class ASTExprPrimTails : List<ASTExprPrimTail>
    {
        public override string ToString()
        {
            return Strings.joinobjs("", this);
        }
    }
    
    public class ASTExprPrimTail
    {
        //
    }

    public class ASTExprPrimTailIncr : ASTExprPrimTail
    {
        public override string ToString()
        {
            return "++";
        }
    }

    public class ASTExprPrimTailDecr : ASTExprPrimTail
    {
        public override string ToString()
        {
            return "--";
        }
    }

    public class ASTExprPrimTailArrow : ASTExprPrimTail
    {
        ASTTypeArgumentList _targs = null;

        public string ident { get; set; }
        public ASTTypeArgumentList targs { get { if (_targs == null)_targs = new ASTTypeArgumentList(); return _targs; } }

        public override string ToString()
        {
            return "->" + ident + targs;
        }
    }

    public class ASTExprPrimTailDot : ASTExprPrimTail
    {
        ASTTypeArgumentList _targs = null;

        public string ident { get; set; }
        public ASTTypeArgumentList targs { get { if (_targs == null)_targs = new ASTTypeArgumentList(); return _targs; } }

        public override string ToString()
        {
            return "." + ident + targs;
        }
    }

    public class ASTExprPrimTailArgs : ASTExprPrimTail
    {
        ASTArguments _args = null;

        public ASTArguments args { get { if (_args == null)_args = new ASTArguments(); return _args; } }

        public override string ToString()
        {
            return "(" + Lazy.toStringNN(_args, "") + ")"; 
        }
    }

    public class ASTExprPrimTailArray : ASTExprPrimTail
    {
        public readonly List<ASTExpr> exprs = new List<ASTExpr>();

        public override string ToString()
        { 
           return "[" + Strings.joinobjs(", ", exprs) + "]";
        }
    }
}
